package com.example.controller;

import com.example.entity.Inline;
import com.example.entity.Standard;
import com.example.mapper.StandardMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController
@RequestMapping("/human")
@Slf4j
public class StandardController {

    @Resource
    private StandardMapper standardMapper;

    @GetMapping("/save/{birth}")
    public String insert(@PathVariable("birth")String birthday) {
        Standard standard = new Standard();
        standard.setNickname(LocalDateTime.now().toString());
        standard.setPassword("123456");
        standard.setSex(1);
        standard.setAge(1);
        standard.setBirthday(birthday);
        standardMapper.addStandard(standard);
        log.info("id:{}",standard.getId());
        return "success";
    }


}
